FROM ubuntu:latest

WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app

RUN apt update && apt-get upgrade -y
RUN apt install libssl-dev libtesseract-dev libicu-dev libicu-dev libcairo2-dev freeglut3 freeglut3-dev libopengl0 libtiff5-dev -y

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Kolkata
RUN apt install tzdata wget zip unzip -y

RUN apt install libreoffice -y
RUN apt install default-jre libreoffice-java-common -y
RUN apt install imagemagick -y
RUN apt install tesseract-ocr-all -y
RUN apt install ffmpeg -y
RUN apt install fontforge -y
RUN apt install calibre -y

RUN apt install python3-pip -y
RUN pip install --no-cache-dir pyrogram==2.0.35 tgcrypto==1.2.3 pickle5==0.0.11 telegraph==2.1.0 pykeyboard==0.1.5 halo==0.0.31 Wand==0.6.8 tensorflow-cpu==2.9.1 requests SpeechRecognition pydub gTTS Pillow

RUN apt-get install software-properties-common -y
RUN apt update && apt-get upgrade -y
RUN add-apt-repository universe -y
RUN apt update && apt-get upgrade -y
RUN apt install p7zip-full p7zip-rar -y
RUN apt-get install python3-numpy python3-pydot python3-matplotlib python3-opencv python3-graphviz python3-toolz -y
RUN wget https://github.com/bipinkrish/Colorize-Positive-Bot/releases/download/Model/model.zip && unzip model.zip && rm model.zip

RUN pip install --no-cache-dir bs4 ttconv py2many pyzbar

RUN apt install curl -y
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN apt-get update -y
RUN apt-get install -y cargo clang-format z3 clang
RUN apt install rustfmt golang-go -y
RUN apt-get install openctm-tools libzbar0 -y

RUN curl -fsSL -o /tmp/warp-packer \
        https://github.com/dgiagio/warp/releases/download/v0.3.0/linux-x64.warp-packer \
    && install -D \
        --mode=755 \
        --owner=root \
        --group=root \
        /tmp/warp-packer \
        /usr/local/bin \
    && rm /tmp/warp-packer
COPY warp4j /usr/local/bin/
RUN chmod 777 /usr/local/bin/warp4j
RUN wget https://www.jflap.org/jflaptmp/july27-18/JFLAP7.1.jar && warp4j JFLAP7.1.jar  && rm -r warped/ && warp4j JFLAP7.1.jar --no-optimize && rm -r warped/ && rm JFLAP7.1.jar

RUN apt update && apt-get upgrade -y
RUN apt install build-essential -y
RUN curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get install ./google-chrome-stable_current_amd64.deb -y
RUN rm google-chrome-stable_current_amd64.deb
RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
    mkdir -p /opt/chromedriver-$CHROMEDRIVER_VERSION && \
    curl -sS -o /tmp/chromedriver_linux64.zip http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \
    unzip -qq /tmp/chromedriver_linux64.zip -d /opt/chromedriver-$CHROMEDRIVER_VERSION && \
    rm /tmp/chromedriver_linux64.zip && \
    chmod +x /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver && \
    ln -fs /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver /usr/local/bin/chromedriver
RUN apt install chromium-browser xvfb -y
RUN apt update && apt-get upgrade -y

RUN pip install --no-cache-dir pyinstaller asteval arrow plotly kaleido websocket-client